<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <title>210-icon偏移问题</title>
    <style>
      .box {
        font-size: 20px;
        margin-bottom: 12px;
        border: 1px solid #e1e1e1;
      }
      .b1 {
        display: flex;
        align-items: center;
      }
      .b2 img {
        vertical-align: -0.15em;
      }
      .icon {
        width: 1em;
        height: 1em;
      }
    </style>
  </head>

  <body>
    <ul>
      <li>原始</li>
      <li class="box b0">abcdxx你好<img class="icon" src="/assets/logo.png" /></li>

      <li>方案一：弹性盒子垂直居中</li>
      <li class="box b1">abcdxx你好<img class="icon" src="/assets/logo.png" /></li>

      <li>
        方案二：vertical-align: -0.15em; 参考自
        <a href="https://icomoon.io/app/" target="_blank">icomoon</a> 的字体图标居中样式
      </li>
      <li class="box b2">abcdxx你好<img class="icon" src="/assets/logo.png" /></li>
    </ul>
  </body>
</html>
